package main.java.io;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;

public class io2 {
    public static void main(String[] args) throws IOException {
        File f = new File("C:\\Users\\86158\\Desktop\\datax.txt");
        File f2 = new File("C:\\Users\\86158\\Desktop\\datax2.txt");
        RandomAccessFile ra1 = new RandomAccessFile(f,"rw");
        RandomAccessFile ra2 = new RandomAccessFile(f2,"rw");
        FileChannel fc1 = ra1.getChannel();
        FileChannel fc2 = ra1.getChannel();

        //fc1数据传入fc2
        fc1.transferTo(0,fc1.size(),fc2);

    }
}
